/*
 * Copyright (C) 2008-2012  Paulo Cesar Pereira de Andrade.
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Authors:
 *	Paulo Cesar Pereira de Andrade
 */

#ifndef _efunction_h
#define _efunction_h

#include "etypes.h"

#define efunction_p(object)	(etype(object) == t_function)

/*
 * Types
 */
struct efunction {
    efunction_t		*next;
    enamespace_t	*namespace;
    evector_t		*name;
    eword_t		 key;
    etag_t		*tag;
    east_t		*ast;
    evalue_t		*value;
    ehash_t		*label_table;
    ehash_t		*alias_table;
    evector_t		*value_vector;
    eword_t		 local_offset;
};

/*
 * Prototypes
 */
extern void
init_function(void);

extern void
finish_function(void);

extern efunction_t *
eget_function(evector_t *name);

extern efunction_t *
enew_function(evector_t *name, etag_t *tag);

/*
 * Externs
 */
extern efunction_t	*root_function;
extern efunction_t	*current_function;
extern ehash_t		*function_table;

#endif /* _efunction_h */
